package ar.edu.utn.frsf.tpae.a2012.g03.model;

import java.util.Date;

import javax.persistence.*;

/**
 *
 * @author fededalla
 */
@Entity
@Table(name = "cja_aho")
@NamedQueries({
    @NamedQuery(name = "CajaAhorro.findAll", query = "SELECT c FROM CajaAhorro c"),
    @NamedQuery(name = "CajaAhorro.findByCtaId", query = "SELECT c FROM CajaAhorro c WHERE c.ctaId = :ctaId"),
    @NamedQuery(name = "CajaAhorro.findByCjaAhoIntMens", query = "SELECT c FROM CajaAhorro c WHERE c.cjaAhoIntMens = :cjaAhoIntMens")})
public class CajaAhorro extends Cuenta{
	
    @Column(name = "cja_aho_int_mens")
    private double cjaAhoIntMens;
 /*   @JoinColumn(name = "cta_id", referencedColumnName = "cta_id", nullable = false, insertable = false, updatable = false)
    private Cuenta cta;*/

    public CajaAhorro() {
    }

    public CajaAhorro(Integer ctaId) {
        this.ctaId = ctaId;
    }

    public CajaAhorro(Integer ctaId, long ctaNro, Date ctaFechApe, double ctaSdoAct, double cjaAhoIntMens,Cliente ctaCliId) {
    	super(ctaId, ctaNro, ctaFechApe, ctaSdoAct,ctaCliId);
        this.cjaAhoIntMens = cjaAhoIntMens;
    }

    public Integer getCtaId() {
        return ctaId;
    }

    public void setCtaId(Integer ctaId) {
        this.ctaId = ctaId;
    }

    public double getCjaAhoIntMens() {
        return cjaAhoIntMens;
    }

    public void setCjaAhoIntMens(double cjaAhoIntMens) {
        this.cjaAhoIntMens = cjaAhoIntMens;
    }

 /*   public Cuenta getCta() {
        return cta;
    }

    public void setCta(Cuenta cta) {
        this.cta = cta;
    }*/

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ctaId != null ? ctaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CajaAhorro)) {
            return false;
        }
        CajaAhorro other = (CajaAhorro) object;
        if ((this.ctaId == null && other.ctaId != null) || (this.ctaId != null && !this.ctaId.equals(other.ctaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.CajaAhorro[ ctaId=" + ctaId + " ]";
    }
    
}
